Jonathan Dieter [Sun, 20 Feb 2022 17:07:24 +0000 (17:07 +0000)]
Merge pull request #70 from zchunk/1.2.0
Release zchunk 1.2.0 with the following changes:
* Now builds for Windows
* Can set `--uncompressed` flag when creating zchunk files to also store uncompressed digests
* `zck_read_header` now indicates whether there's a dictionary and what flags are enabled in the zchunk file
* Minimum meson version required to build zchunk is now 0.53
* Switched to use GitHub actions for automated testing
* Added the following automated test environments:
* `centos-8-stream`
* `centos-9-stream`
* `ubuntu-lts`
* `windows`, both using Mamba and meson-wrap
* `macos`
Eli Schwartz [Wed, 5 Jan 2022 04:45:20 +0000 (23:45 -0500)]
meson: add subproject fallback for zstd
installed via the command:
```
meson wrap install zstd
```
This file does nothing, unless a dependency cannot be found; in that
case, instead of failing, meson will download a private copy of the
dependency and build + link to that instead.
(This is especially common on Windows, where managing dependencies
without a package manager can be difficult.)
Alternatively, users interested in specifically building a statically
linked / portable executable can configure meson with
`--wrap-mode=forcefallback` to prefer the private copy.
Eli Schwartz [Wed, 5 Jan 2022 04:42:03 +0000 (23:42 -0500)]
meson: fix incorrect use of global arguments to set symbol visibility
add_global_arguments applies to all subprojects, or more usually, fails.
The meson docs suggest that add_project_arguments is probably preferable
for this reason.
However, in this case it should only be applied to a single library as a
workaround for supporting older versions of meson. Move it to a
per-target c_args instead, for the same effect.
function declarations should always explicitly say no argument is expected,
as in C 'foo bar()' means bar can take any parameter.
This was noticed when building another project with -Wall -Wextra and getting
the following warning on installed header:
/usr/include/zck.h:66:5: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
66 | __attribute__ ((warn_unused_result));
| ^~~~~~~~~~~~~
/usr/include/zck.h:325:5: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
325 | __attribute__ ((warn_unused_result));
| ^~~~~~~~~~~~~
uthash are generated only when a zck is read when index is parsed. In
case a comparison is done between a zck and a generated zck, to search
for hash both need to have a uthash database, so add function to create
the database when zck is created.
Add a function to assembly a zck with chunks from another zck (source).
The resulkting zck will contain all chunks from source when the hash
(compressed or not compressed in case the compressors are different)
matches.
Index is just one, there is no need to duplicate the structure to
support uthash for digest related to the uncompressed data. Drop
index_uncomp and add uthash for uncompressed data.
When zck is used as library, the caller has already its own LOG system.
It is nice to redirect zck's log into the main logger. ZCK can already
write into a fd specified by the user, but this add complexity in case
it cannot be mapped, for example if LOG should be sent to network or is
managed in a different way. iNot only, information like loglevel are
lost.
Stefano Babic [Tue, 31 Aug 2021 12:43:12 +0000 (14:43 +0200)]
Drop assert in zrealloc and raise runtime error
Most assert in code are useful because they signal a real bug. However,
if allocation on the heap fails, it is a runtime error because system
gets rid of memory. This is more important on embedded systems,
and the caller process cannot exit but it should be informed with return
code and it will decide how to work on.
This drop the assert clause and add error code handling when zrealloc is
called. Because realloc does not touch the original pointer if fails, it
frees memory to avoid leaks.
Stefano Babic [Sat, 28 Aug 2021 14:18:54 +0000 (16:18 +0200)]
Add a way to disable check of chunk min size
The check for chunk size is done on the compressed data.
This forbids to create the same chunk set in case data is not compressed
and comparison is done using the hashes of original data and not of
compressed chunk.
Stefano Babic [Tue, 17 Aug 2021 11:21:43 +0000 (13:21 +0200)]
Drop assert in zmalloc and raise runtime error
Most assert in code are useful because they signal a real bug. However,
if allocation on the heap fails, it is a runtime error because system
gets rid of memory. This is more important on embedded systems,
and the caller process cannot exit but it should be informed with return
code and it will decide how to work on.
This drop the assert clause and add error code handling when zmalloc is
called.